reports

package
v0.0.0-...-7a052df Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DispositionTypeAdd = "add"
View Source
const DispositionTypeReplace = "replace"
View Source
const IssueLevelError = "ERROR"
View Source
const IssueLevelWarning = "WARNING"
View Source
const StageFileCopy = "blob-file-copy"
View Source
const StageMetadataTransform = "metadata-transform"
View Source
const StageMetadataVerify = "metadata-verify"
View Source
const StageUploadCompleted = "upload-completed"
View Source
const StageUploadStarted = "upload-started"
View Source
const StageUploadStatus = "upload-status"
View Source
const StatusFailed = "FAILURE"
View Source
const StatusSuccess = "SUCCESS"

Variables

Functions

func CloseAll

func CloseAll()

func Publish

func Publish(ctx context.Context, r *Report)

func Register

func Register(r event.Publisher[*Report])

Types

type Builder

type Builder[T any] interface {
	SetAction(string) Builder[T]
	SetUploadId(string) Builder[T]
	SetManifest(map[string]string) Builder[T]
	AppendIssue(ReportIssue) Builder[T]
	SetStatus(string) Builder[T]
	SetStartTime(time.Time) Builder[T]
	SetEndTime(time.Time) Builder[T]
	SetDispositionType(string) Builder[T]
	SetContent(T) Builder[T]
	Build() *Report
}

func NewBuilder

func NewBuilder[T any](version string, action string, uploadId string, dispType string) Builder[T]

func NewBuilderWithManifest

func NewBuilderWithManifest[T any](version string, action string, uploadId string, manifest map[string]string, dispType string) Builder[T]

type BulkMetadataTransformReportContent

type BulkMetadataTransformReportContent struct {
	ReportContent
	Transforms []MetadataTransformContent `json:"transforms"`
}

type FileCopyContent

type FileCopyContent struct {
	ReportContent
	FileSourceBlobUrl      string `json:"file_source_blob_url"`
	FileDestinationBlobUrl string `json:"file_destination_blob_url"`
	DestinationName        string `json:"destination_name"`
}

type MetaDataVerifyContent

type MetaDataVerifyContent struct {
	ReportContent
	Filename string `json:"filename"`
	Metadata any    `json:"metadata"`
}

type MetadataTransformContent

type MetadataTransformContent struct {
	Action string `json:"action"` // append, update, remove
	Field  string `json:"field"`  // Name of the field the action was performed on
	Value  string `json:"value"`  // Optional; Value given to the appended or updated field.
}

type Report

type Report struct {
	Event               event.Event     `json:"-"`
	ReportSchemaVersion string          `json:"report_schema_version"`
	UploadID            string          `json:"upload_id"`
	SenderID            string          `json:"sender_id"`
	DataStreamID        string          `json:"data_stream_id"`
	DataStreamRoute     string          `json:"data_stream_route"`
	Jurisdiction        string          `json:"jurisdiction"`
	DexIngestDatetime   string          `json:"dex_ingest_datetime"`
	ContentType         string          `json:"content_type"`
	DispositionType     string          `json:"disposition_type"`
	StageInfo           ReportStageInfo `json:"stage_info"`
	Content             any             `json:"content"` // TODO: Can we limit this to a specific type (i.e. ReportContent or UploadStatusTYpe type?
}

func (*Report) Identifier

func (r *Report) Identifier() string

func (*Report) IncrementRetryCount

func (r *Report) IncrementRetryCount()

func (*Report) OrigMessage

func (r *Report) OrigMessage() *azservicebus.ReceivedMessage

func (*Report) RetryCount

func (r *Report) RetryCount() int

func (*Report) SetIdentifier

func (r *Report) SetIdentifier(id string)

func (*Report) SetOrigMessage

func (r *Report) SetOrigMessage(_ *azservicebus.ReceivedMessage)

func (*Report) SetType

func (r *Report) SetType(t string)

func (*Report) Type

func (r *Report) Type() string

type ReportBuilder

type ReportBuilder[T any] struct {
	Action          string
	Version         string
	UploadId        string
	Manifest        map[string]string
	Issues          []ReportIssue
	Status          string
	StartTime       time.Time
	EndTime         time.Time
	DispositionType string
	Content         T
}

func (*ReportBuilder[T]) AppendIssue

func (b *ReportBuilder[T]) AppendIssue(i ReportIssue) Builder[T]

func (*ReportBuilder[T]) Build

func (b *ReportBuilder[T]) Build() *Report

func (*ReportBuilder[T]) SetAction

func (b *ReportBuilder[T]) SetAction(s string) Builder[T]

func (*ReportBuilder[T]) SetContent

func (b *ReportBuilder[T]) SetContent(c T) Builder[T]

func (*ReportBuilder[T]) SetDispositionType

func (b *ReportBuilder[T]) SetDispositionType(d string) Builder[T]

func (*ReportBuilder[T]) SetEndTime

func (b *ReportBuilder[T]) SetEndTime(t time.Time) Builder[T]

func (*ReportBuilder[T]) SetManifest

func (b *ReportBuilder[T]) SetManifest(m map[string]string) Builder[T]

func (*ReportBuilder[T]) SetStartTime

func (b *ReportBuilder[T]) SetStartTime(t time.Time) Builder[T]

func (*ReportBuilder[T]) SetStatus

func (b *ReportBuilder[T]) SetStatus(s string) Builder[T]

func (*ReportBuilder[T]) SetUploadId

func (b *ReportBuilder[T]) SetUploadId(id string) Builder[T]

type ReportContent

type ReportContent struct {
	ContentSchemaName    string `json:"content_schema_name"`
	ContentSchemaVersion string `json:"content_schema_version"`
}

type ReportIssue

type ReportIssue struct {
	Level   string `json:"level"`
	Message string `json:"message"`
}

func (*ReportIssue) String

func (r *ReportIssue) String() string

type ReportStageInfo

type ReportStageInfo struct {
	Service          string        `json:"service"`
	Action           string        `json:"action"`
	Version          string        `json:"version"`
	Status           string        `json:"status"`
	Issues           []ReportIssue `json:"issues"`
	StartProcessTime string        `json:"start_processing_time"`
	EndProcessTime   string        `json:"end_processing_time"`
}

type UploadLifecycleContent

type UploadLifecycleContent struct {
	ReportContent
	Status string `json:"status"`
}

type UploadStatusContent

type UploadStatusContent struct {
	ReportContent
	Filename string `json:"filename"`
	Tguid    string `json:"tguid"`
	Offset   int64  `json:"offset"`
	Size     int64  `json:"size"`
}

Jump to

Keyboard shortcuts

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