Documentation
¶
Index ¶
- Variables
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type InMemoryBackend
- func (b *InMemoryBackend) DeleteReportDefinition(name string) error
- func (b *InMemoryBackend) DeliverDue(ctx context.Context)
- func (b *InMemoryBackend) DescribeReportDefinitions(token string, maxResults *int32) (page.Page[reportDefinitionWire], error)
- func (b *InMemoryBackend) ListTagsForResource(name string) ([]tags.KV, error)
- func (b *InMemoryBackend) ModifyReportDefinition(ctx context.Context, name string, w *reportDefinitionWire) error
- func (b *InMemoryBackend) PutReportDefinition(ctx context.Context, w *reportDefinitionWire, tagList []tags.KV) error
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SetCostSource(c billingexport.CostSource)
- func (b *InMemoryBackend) SetObjectStore(s billingexport.ObjectStore)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(name string, list []tags.KV) error
- func (b *InMemoryBackend) UntagResource(name string, keys []string) error
- type Provider
- type Report
Constants ¶
This section is empty.
Variables ¶
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 (*Handler) ChaosOperations ¶
ChaosOperations lists the fault-injectable operations.
func (*Handler) ChaosRegions ¶
ChaosRegions lists the regions this handler serves; CUR is homed in us-east-1.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase service name for fault rules.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name from X-Amz-Target.
func (*Handler) ExtractResource ¶
ExtractResource returns the operation name; the API has no single resource key.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists every routed operation.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the echo handler.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher matches the AWSOrigamiServiceGatewayService X-Amz-Target prefix.
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) 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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init builds the backend and handler.
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.