Help us shape the future of Go! Take the 2026 Go Developer Survey

cur

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 27 Imported by: 0

README

Cur

Parity grade: B · SDK aws-sdk-go-v2/service/costandusagereportservice@v1.43.4 · last audited 2026-10-18 (4ae40e79e)

Coverage

Metric Value
PARITY entries audited 7 (7 ok)
Feature families 2 (2 ok)
Known gaps 6
Deferred items 0
Resource leaks clean
Known gaps
  • columns: report schema is a subset of the real CUR columns (about 25 base columns plus RESOURCES and split-cost columns); reservation, savingsPlan, discount, resourceTags and product attribute columns are absent
  • MANUAL_DISCOUNT_COMPATIBILITY: accepted but adds no columns
  • ResourceId and tags: lineItem/ResourceId is empty because the cost ledger has no per-resource data
  • lastDelivery: emitted as RFC 3339; the real service string format is unverified
  • ATHENA artifacts: crawler template is minimal and cost_and_usage_data_status files are not written
  • BillingViewArn: format-checked only, no billing view backend

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateReportName = errors.New("report name already exists")
	ErrInternalError       = errors.New("internal error")
	ErrReportLimitReached  = errors.New("report limit reached")
	ErrResourceNotFound    = errors.New("report not found")
	ErrValidation          = errors.New("validation failed")
)

Sentinels, one per exception in the pinned SDK's error set.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Backend *InMemoryBackend
}

Handler serves the Cost and Usage Reports awsjson1.1 API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler wraps a backend.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations lists the fault-injectable operations.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions lists the regions this handler serves; CUR is homed in us-east-1.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase service name for fault rules.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name from X-Amz-Target.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the operation name; the API has no single resource key.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations lists every routed operation.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the echo handler.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher matches the AWSOrigamiServiceGatewayService X-Amz-Target prefix.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker runs scheduled report delivery until ctx is cancelled.

type InMemoryBackend

type InMemoryBackend struct {
	// contains filtered or unexported fields
}

InMemoryBackend is the CUR state; one coarse lock guards the report table and the wired sinks.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) DeleteReportDefinition

func (b *InMemoryBackend) DeleteReportDefinition(name string) error

DeleteReportDefinition removes a report definition.

func (*InMemoryBackend) DeliverDue

func (b *InMemoryBackend) DeliverDue(ctx context.Context)

DeliverDue delivers every report that has not yet been delivered in its current HOURLY, DAILY or MONTHLY slot.

func (*InMemoryBackend) DescribeReportDefinitions

func (b *InMemoryBackend) DescribeReportDefinitions(
	token string,
	maxResults *int32,
) (page.Page[reportDefinitionWire], error)

DescribeReportDefinitions lists definitions ordered by name.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(name string) ([]tags.KV, error)

ListTagsForResource returns a report's tags.

func (*InMemoryBackend) ModifyReportDefinition

func (b *InMemoryBackend) ModifyReportDefinition(ctx context.Context, name string, w *reportDefinitionWire) error

ModifyReportDefinition replaces a report definition, keeping tags and delivery status.

func (*InMemoryBackend) PutReportDefinition

func (b *InMemoryBackend) PutReportDefinition(ctx context.Context, w *reportDefinitionWire, tagList []tags.KV) error

PutReportDefinition creates a report definition.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the home region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears every report.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads a snapshot; an incompatible version is discarded.

func (*InMemoryBackend) SetCostSource

func (b *InMemoryBackend) SetCostSource(c billingexport.CostSource)

SetCostSource wires the cost data report rows are derived from.

func (*InMemoryBackend) SetObjectStore

func (b *InMemoryBackend) SetObjectStore(s billingexport.ObjectStore)

SetObjectStore wires the S3 reports are delivered to.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(name string, list []tags.KV) error

TagResource adds or replaces tags on a report.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(name string, keys []string) error

UntagResource removes tags by key.

type Provider

type Provider struct{}

Provider implements service.Provider for AWS Cost and Usage Reports.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type Report

type Report struct {
	CreatedAt                time.Time         `json:"createdAt"`
	Tags                     map[string]string `json:"tags"`
	ReportName               string            `json:"reportName"`
	TimeUnit                 string            `json:"timeUnit"`
	Format                   string            `json:"format"`
	Compression              string            `json:"compression"`
	S3Bucket                 string            `json:"s3Bucket"`
	S3Prefix                 string            `json:"s3Prefix"`
	S3Region                 string            `json:"s3Region"`
	ReportVersioning         string            `json:"reportVersioning"`
	BillingViewArn           string            `json:"billingViewArn"`
	LastDelivery             string            `json:"lastDelivery"`
	LastStatus               string            `json:"lastStatus"`
	LastSlot                 string            `json:"lastSlot"`
	AdditionalSchemaElements []string          `json:"additionalSchemaElements"`
	AdditionalArtifacts      []string          `json:"additionalArtifacts"`
	RefreshClosedReports     bool              `json:"refreshClosedReports"`
}

Report is a stored report definition plus delivery state.

Jump to

Keyboard shortcuts

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