ce

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 24 Imported by: 0

README

Cost Explorer

Parity grade: A · SDK aws-sdk-go-v2/service/costexplorer@v1.67.4 · last audited 2026-08-30 (021efa0d5)

Coverage

Metric Value
PARITY entries audited 37 (37 ok)
Feature families 13 (13 ok)
Known gaps 4
Deferred items 2
Resource leaks clean
Known gaps
  • 2026-08-30 pagination/filter retrofit pass: reqfieldscan regenerated independently (68 fields across 24 ops, matching gopherstack-43o8's carried-forward figure exactly) and closed to 8, every one hand-verified as an honest gap, not a defect deferred for time. Remaining: (1) GetCostComparisonDriversInput.Filter -- CostComparisonDrivers is always [] (no per-line-item cost-change attribution state exists), so there is nothing for a filter to narrow; accepted for wire parity only. (2) GetReservationCoverageInput.GroupBy and (3) GetReservationUtilizationInput.GroupBy -- both ops' CoveragesByTime/UtilizationsByTime entries never populate a per-group Groups breakdown (always []), no per-SERVICE/AZ/... RI state exists to derive one from. (4) GetSavingsPlansCoverageInput.SortBy -- this op documents no 'Time' sort key (unlike GetReservationCoverage), and the numeric keys it does document have no per-bucket-varying value to sort by honestly. (5) GetSavingsPlansCoverageInput.GroupBy -- same no-per-group-breakdown shape as Reservation Coverage/Utilization. (6) GetSavingsPlansCoverageInput.Metrics -- the only real valid value (SpendCoveredBySavingsPlans) doesn't change the Coverage struct's fixed shape, so there is no differing output to select between. (7) GetSavingsPlansUtilizationDetailsInput.SortBy -- this op always returns exactly one synthetic detail item, so any ordering is trivially a no-op (same shape as GetSavingsPlansCoverage's SortBy before this pass added bucketing). (8) ListCostCategoryResourceAssociationsInput.CostCategoryArn -- real AWS's own validators.go has no required-field check for this op and there is no confirmed evidence (doc page or SDK source) of what a nonexistent ARN does; an earlier draft of this fix guessed 'return not-found' and broke an existing test, which is exactly the fabricated-validation-behavior class this campaign warns against, so it was reverted. All 8 are declared on their wire structs (not silently dropped from the struct entirely) and documented at their op/family notes above. Every ADDRESSED item from gopherstack-43o8's list (pagination on GetCostAndUsage/GetCostAndUsageComparisons/GetCostAndUsageWithResources/GetReservationCoverage/GetReservationPurchaseRecommendation/GetReservationUtilization/GetRightsizingRecommendation/GetSavingsPlansCoverage/GetSavingsPlansPurchaseRecommendation/GetSavingsPlansUtilization/GetSavingsPlansUtilizationDetails/ListCostCategoryResourceAssociations/ListSavingsPlansPurchaseRecommendationGeneration/ListCostAllocationTags/ListCostAllocationTagBackfillHistory, plus AccountScope/ResourceTagFilter-bug/RecommendationIDs/AnalysisStatus/EffectiveOn) is now real, wired, and tested -- see per-op notes above.
  • GetCostForecast/GetUsageForecast still lack required-field validation that the real aws-sdk-go-v2 client-side validators enforce (TimePeriod and Metric are both 'This member is required' on GetCostForecastInput/GetUsageForecastInput). GetCostAndUsage's TimePeriod/Metrics gap was closed in an earlier pass, and this 2026-08-30 pass closed the same gap for GetDimensionValues/GetTags/GetCostCategories (see their op notes) -- GetCostForecast/GetUsageForecast are the two ops still open from the original five-op list, deliberately left alone since Metric's absence changed this pass's forecast-metric fix (GetForecastByTime now genuinely uses the requested Metric) rather than its presence validation, and touching required-field validation here risks the same larger set of existing lenient test call sites the earlier pass flagged. Candidate for a dedicated follow-up pass. (bd: needs issue)
  • AnomalyMonitor.LastEvaluatedDate (types.AnomalyMonitor, 'the date the monitor last evaluated for anomalies') is never set. Unlike DimensionalValueCount (fixed 2026-08-29), there is no real backing state to derive this from: this backend has no anomaly-detection evaluation engine anywhere (StartJanitor's evictExpiredAnomalies only expires already-existing Anomaly records, it does not generate them from cost data or 'evaluate' a monitor), so any timestamp here would be fabricated rather than read from real state. AnomalyMonitor.DimensionalValueCount for the TAG/COST_CATEGORY dimensions has the same gap (only SERVICE/LINKED_ACCOUNT have a real per-entry field in the cost ledger to count distinct values of).
  • gopherstack-s2i4 (audited 2026-09-08, CLOSED as not-a-defect): DataUnavailableException (types.DataUnavailableException, costexplorer@v1.67.4 types/errors.go:118, doc comment verbatim 'The requested data is unavailable.') is declared in the wire model on 22 of ce's 47 operations (confirmed identical 22-op sets independently in both botocore's ce/2017-10-25/service-2.json.gz per-op errors lists and this SDK's deserializers.go case sites -- the original issue title's 'every op' overstates this) but errors.go's ErrDataUnavailable is never referenced anywhere outside its own declaration -- no backend path returns it and handler.go's handleError has no case for it. Two independent documentation research passes (gopherstack-1kse, closed 2026-09-06, reverified this pass) found no citable AWS trigger, threshold, or condition tying this exception to any documented behavior: CE's 14/38-month data-retention window is documented but never linked to this exception, and the one adjacent documented case (forecast horizon limits) is documented as producing a validation error instead. gopherstack's own data-less-query behavior is deliberately never 'unavailable': GetCostAndUsage's GroupBy path fabricates a full synthetic non-empty result for any period with no ledger entries (syntheticGroupsFallback, cost_usage.go:47, '...giving callers a valid non-empty response shape for any time period'), and its non-GroupBy path returns a real zero-valued total, never an error. Since this emulator's synthetic ledger never holds real billing data, every query is 'unavailable' by the naive doc-string reading -- emitting the exception on that basis would fail every GetCostAndUsage-family call, strictly worse than the status quo. Verdict: correctly not modelled; the declared-but-unreturned code is honest, not a defect.
Deferred
  • Reservation/SavingsPlans numeric-formula fidelity (the specific ratios in backend.go's syntheticServiceCatalog / spCommitmentRatio / riPurchasedCostRatio etc.) -- these produce plausible, internally-consistent numbers but were not cross-checked against any real AWS CE billing behavior; by definition there is no real data to match against, so this is a modeling-quality concern for a future pass, not a correctness bug.
  • GetCostAndUsageWithResources.ResultsByTime and ListCostCategoryResourceAssociations.CostCategoryResourceAssociations are always empty by design (see per-op notes above) -- both would need a per-resource / resource-tag inventory this emulator doesn't model anywhere else in the service. Not a disguised no-op (input-driven required-field validation now happens, and the wire shape is correct), just genuinely no backing state to report. A future pass could seed a small synthetic per-resource inventory if resource-level fidelity becomes a priority.

More

Documentation

Overview

Package ce provides an in-memory implementation of the AWS Cost Explorer (Ce) service.

Index

Constants

View Source
const DefaultAnomalyTTL = 30 * 24 * time.Hour

DefaultAnomalyTTL is the default time-to-live for detected anomalies.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource with the same name already exists.
	ErrAlreadyExists = awserr.New("ServiceQuotaExceededException", awserr.ErrConflict)
	// ErrValidation is returned when input parameters fail validation. Real AWS CE's
	// documented common-error type for malformed/missing-required-member requests is
	// "ValidationError" (confirmed via the CE API reference's CommonErrors page), not a
	// named per-operation exception -- CE's errors.go typed-exception list (checked
	// against aws-sdk-go-v2/service/costexplorer/types) has no ValidationException or
	// InvalidParameterException entry for any operation in this audit.
	ErrValidation = errors.New("ValidationError")
	// ErrDataUnavailable is returned when queried data is not available for the time range.
	ErrDataUnavailable = awserr.New("DataUnavailableException", awserr.ErrNotFound)
	// ErrUnknownMonitor is returned when a referenced cost anomaly monitor ARN does not
	// exist. Real AWS CE returns this (not the generic ResourceNotFoundException) from
	// every anomaly-monitor op and from any op whose MonitorArnList references a monitor
	// that doesn't exist.
	ErrUnknownMonitor = awserr.New("UnknownMonitorException", awserr.ErrNotFound)
	// ErrUnknownSubscription is returned when a referenced cost anomaly subscription ARN
	// does not exist. Real AWS CE returns this (not the generic ResourceNotFoundException)
	// from every anomaly-subscription op.
	ErrUnknownSubscription = awserr.New("UnknownSubscriptionException", awserr.ErrNotFound)
)

Functions

This section is empty.

Types

type Anomaly

type Anomaly struct {
	CreationDate     time.Time          `json:"creationDate"`
	AnomalyID        string             `json:"anomalyID"`
	AnomalyStartDate string             `json:"anomalyStartDate"`
	AnomalyEndDate   string             `json:"anomalyEndDate"`
	DimensionValue   string             `json:"dimensionValue"`
	MonitorARN       string             `json:"monitorARN"`
	SubscriptionARN  string             `json:"subscriptionARN"`
	FeedbackType     string             `json:"feedbackType"`
	RootCauses       []AnomalyRootCause `json:"rootCauses,omitempty"`
	AnomalyScore     AnomalyScore       `json:"anomalyScore"`
	TotalImpact      float64            `json:"totalImpact"`
}

Anomaly represents a detected cost anomaly in AWS CE.

type AnomalyMonitor

type AnomalyMonitor struct {
	CreationDate         time.Time         `json:"creationDate"`
	LastUpdatedDate      time.Time         `json:"lastUpdatedDate"`
	Tags                 map[string]string `json:"tags"`
	MonitorSpecification *ceExpression     `json:"monitorSpecification,omitempty"`
	MonitorARN           string            `json:"monitorARN"`
	MonitorName          string            `json:"monitorName"`
	MonitorType          string            `json:"monitorType"`
	MonitorDimension     string            `json:"monitorDimension"`
}

AnomalyMonitor represents an in-memory AWS CE anomaly monitor. MonitorSpecification is the Expression that scopes a CUSTOM monitor (or a DIMENSIONAL monitor with MonitorDimension TAG/COST_CATEGORY) -- required input on CreateAnomalyMonitor, echoed back on GetAnomalyMonitors per types.AnomalyMonitor (costexplorer@v1.67.4 types/types.go).

type AnomalyRootCause

type AnomalyRootCause struct {
	Service       string `json:"Service,omitempty"`
	Region        string `json:"Region,omitempty"`
	LinkedAccount string `json:"LinkedAccount,omitempty"`
	UsageType     string `json:"UsageType,omitempty"`
}

AnomalyRootCause identifies a root cause dimension for an anomaly.

type AnomalyScore

type AnomalyScore struct {
	MaxScore     float64 `json:"MaxScore"`
	CurrentScore float64 `json:"CurrentScore"`
}

AnomalyScore represents the anomaly detection score.

type AnomalySubscription

type AnomalySubscription struct {
	CreationDate        time.Time         `json:"creationDate"`
	Tags                map[string]string `json:"tags"`
	ThresholdExpression *ceExpression     `json:"thresholdExpression,omitempty"`
	SubscriptionARN     string            `json:"subscriptionARN"`
	SubscriptionName    string            `json:"subscriptionName"`
	AccountID           string            `json:"accountID"`
	Frequency           string            `json:"frequency"`
	MonitorARNList      []string          `json:"monitorARNList"`
	Subscribers         []Subscriber      `json:"subscribers"`
	Threshold           float64           `json:"threshold"`
}

AnomalySubscription represents an in-memory AWS CE anomaly subscription. ThresholdExpression is the non-deprecated alternative to Threshold (real AWS: "you can specify either Threshold or ThresholdExpression, but not both" -- costexplorer@v1.67.4 types/types.go's AnomalySubscription doc comment); both CreateAnomalySubscriptionInput and UpdateAnomalySubscriptionInput accept it.

type BackfillJob

type BackfillJob struct {
	BackfillID     string `json:"backfillID"`
	BackfillFrom   string `json:"backfillFrom"`
	RequestedAt    string `json:"requestedAt"`
	CompletedAt    string `json:"completedAt,omitempty"`
	BackfillStatus string `json:"backfillStatus"` // SUCCEEDED|PROCESSING|FAILED
	LastUpdatedAt  string `json:"lastUpdatedAt"`
}

BackfillJob represents a cost allocation tag backfill job. BackfillID is internal-only -- real AWS's CostAllocationTagBackfillRequest has no unique identifier field at all (NextToken is fully opaque), so this is not a fabricated wire field, just a stable sort/pagination key this backend needs since RequestedAt alone (second precision) can tie between jobs created in the same second.

type CommitmentAnalysis

type CommitmentAnalysis struct {
	Configuration           any    `json:"configuration,omitempty"`
	AnalysisID              string `json:"analysisId"`
	AnalysisStatus          string `json:"analysisStatus"` // SUCCEEDED|PROCESSING|FAILED
	AnalysisStartedTime     string `json:"analysisStartedTime"`
	EstimatedCompletionTime string `json:"estimatedCompletionTime"`
	ErrorCode               string `json:"errorCode,omitempty"`
}

CommitmentAnalysis represents a commitment purchase analysis.

type CostAllocationTag

type CostAllocationTag struct {
	TagKey          string `json:"tagKey"`
	Status          string `json:"status"` // Active | Inactive
	Type            string `json:"type"`   // AWSGenerated | UserDefined
	LastUpdatedDate string `json:"lastUpdatedDate"`
}

CostAllocationTag represents an AWS CE cost allocation tag.

type CostAllocationTagError

type CostAllocationTagError struct {
	TagKey  string `json:"TagKey"`
	Code    string `json:"Code"`
	Message string `json:"Message"`
}

CostAllocationTagError holds an error for a single tag key update.

type CostAllocationTagStatusEntry

type CostAllocationTagStatusEntry struct {
	TagKey string `json:"TagKey"`
	Status string `json:"Status"`
}

CostAllocationTagStatusEntry is a TagKey+Status pair for UpdateCostAllocationTagsStatus.

type CostCategory

type CostCategory struct {
	CreationDate     time.Time          `json:"creationDate"`
	Tags             map[string]string  `json:"tags"`
	ARN              string             `json:"arn"`
	Name             string             `json:"name"`
	RuleVersion      string             `json:"ruleVersion"`
	DefaultValue     string             `json:"defaultValue"`
	EffectiveStart   string             `json:"effectiveStart"`
	Rules            []CostCategoryRule `json:"rules"`
	SplitChargeRules []SplitChargeRule  `json:"splitChargeRules"`
}

CostCategory represents an in-memory AWS Cost Explorer cost category.

type CostCategoryRule

type CostCategoryRule struct {
	Value string `json:"value"`
}

CostCategoryRule represents a single cost category rule.

type CostEntry

type CostEntry struct {
	Tags          map[string]string `json:"tags"`
	Date          string            `json:"date"`
	Service       string            `json:"service"`
	Region        string            `json:"region"`
	UsageType     string            `json:"usageType"`
	Account       string            `json:"account"`
	BlendedCost   float64           `json:"blendedCost"`
	UnblendedCost float64           `json:"unblendedCost"`
	UsageQuantity float64           `json:"usageQuantity"`
}

CostEntry is a synthetic cost ledger entry for a single day+service combination.

type CostGroup

type CostGroup struct {
	Metrics map[string]MetricValue `json:"Metrics"`
	Keys    []string               `json:"Keys"`
}

CostGroup represents a group in a cost result.

type ForecastResult

type ForecastResult struct {
	TimePeriod                   map[string]string `json:"TimePeriod"`
	MeanValue                    string            `json:"MeanValue"`
	PredictionIntervalLowerBound string            `json:"PredictionIntervalLowerBound,omitempty"`
	PredictionIntervalUpperBound string            `json:"PredictionIntervalUpperBound,omitempty"`
}

ForecastResult represents a single time-bucket forecast entry.

type GroupBySpec

type GroupBySpec struct {
	Type string `json:"Type"`
	Key  string `json:"Key"`
}

GroupBySpec represents a single GroupBy dimension spec.

type Handler

type Handler struct {
	Backend *InMemoryBackend
	// contains filtered or unexported fields
}

Handler is the Echo HTTP handler for Cost Explorer (Ce) operations.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new Cost Explorer handler backed by backend. backend must not be nil.

func (*Handler) ChaosOperations

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

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

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

ChaosRegions returns all regions this handler instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

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

ExtractOperation extracts the Cost Explorer action from the X-Amz-Target header.

func (*Handler) ExtractResource

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

ExtractResource extracts the resource identifier from the request (not used for Ce).

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

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

Handler returns the Echo handler function for Cost Explorer requests.

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 implements service.Resettable by delegating to the backend.

func (*Handler) Restore

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

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

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

RouteMatcher returns a function that matches Cost Explorer requests.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable by delegating to the backend.

type InMemoryBackend

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

InMemoryBackend is a thread-safe in-memory store for Cost Explorer resources.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new backend for the given account and region.

func (*InMemoryBackend) AddAnomaly

func (b *InMemoryBackend) AddAnomaly(a Anomaly)

AddAnomaly inserts an anomaly into the backend. It is intended for testing.

func (*InMemoryBackend) CreateAnomalyMonitor

func (b *InMemoryBackend) CreateAnomalyMonitor(
	monitorName, monitorType, monitorDimension string,
	monitorSpecification *ceExpression,
	resourceTags map[string]string,
) (*AnomalyMonitor, error)

CreateAnomalyMonitor creates a new anomaly monitor.

func (*InMemoryBackend) CreateAnomalySubscription

func (b *InMemoryBackend) CreateAnomalySubscription(
	subscriptionName, frequency string,
	monitorARNList []string,
	subscribers []Subscriber,
	threshold float64,
	thresholdExpression *ceExpression,
	resourceTags map[string]string,
) (*AnomalySubscription, error)

CreateAnomalySubscription creates a new anomaly subscription.

func (*InMemoryBackend) CreateBackfillJob

func (b *InMemoryBackend) CreateBackfillJob(backfillFrom string) *BackfillJob

CreateBackfillJob creates a new cost allocation tag backfill job.

func (*InMemoryBackend) CreateCommitmentAnalysis

func (b *InMemoryBackend) CreateCommitmentAnalysis(configuration any) *CommitmentAnalysis

CreateCommitmentAnalysis starts a new commitment purchase analysis. configuration is stored and echoed back verbatim on Get/List/Start (real GetCommitmentPurchaseAnalysisOutput/AnalysisSummary both carry CommitmentPurchaseAnalysisConfiguration) -- this backend doesn't simulate analysis internals, so it round-trips the request's configuration rather than fabricating computed contents.

func (*InMemoryBackend) CreateCostCategoryDefinition

func (b *InMemoryBackend) CreateCostCategoryDefinition(
	name, ruleVersion, defaultValue string,
	rules []CostCategoryRule,
	resourceTags map[string]string,
	splitChargeRules []SplitChargeRule,
	requestedEffectiveStart string,
) (*CostCategory, error)

CreateCostCategoryDefinition creates a new cost category and returns it. requestedEffectiveStart, when non-empty, overrides the default "first day of the current month" real AWS also defaults to when the field is omitted (api_op_CreateCostCategoryDefinition.go).

func (*InMemoryBackend) CreateSavingsPlansGeneration added in v1.2.0

func (b *InMemoryBackend) CreateSavingsPlansGeneration() *SavingsPlansGeneration

CreateSavingsPlansGeneration starts a new Savings Plans purchase recommendation generation job and persists it, mirroring the CommitmentAnalysis start/persist/list/get pattern used elsewhere in this backend.

func (*InMemoryBackend) DeleteAnomalyMonitor

func (b *InMemoryBackend) DeleteAnomalyMonitor(monARN string) error

DeleteAnomalyMonitor removes an anomaly monitor by ARN.

func (*InMemoryBackend) DeleteAnomalySubscription

func (b *InMemoryBackend) DeleteAnomalySubscription(subARN string) error

DeleteAnomalySubscription removes an anomaly subscription by ARN.

func (*InMemoryBackend) DeleteCostCategoryDefinition

func (b *InMemoryBackend) DeleteCostCategoryDefinition(catARN string) (*CostCategory, error)

DeleteCostCategoryDefinition removes a cost category by ARN.

func (*InMemoryBackend) DescribeCostCategoryDefinition

func (b *InMemoryBackend) DescribeCostCategoryDefinition(catARN string) (*CostCategory, error)

DescribeCostCategoryDefinition returns a cost category by ARN.

func (*InMemoryBackend) DimensionValueCost added in v1.3.1

func (b *InMemoryBackend) DimensionValueCost(dimension, value, metric string) float64

DimensionValueCost sums the requested cost metric ("UnblendedCost" or any other value, which defaults to BlendedCost) across ledger entries whose `dimension` equals value. Used to give GetDimensionValues' SortBy a real, non-fabricated ordering over the returned dimension values.

func (*InMemoryBackend) GetAnomalies

func (b *InMemoryBackend) GetAnomalies(
	monitorARN, feedback, startDate, endDate string, maxResults int, nextPageToken string,
	totalImpact *TotalImpactFilter,
) ([]*Anomaly, string)

GetAnomalies returns detected anomalies, optionally filtered by monitor ARN, feedback type, date interval, and total dollar impact. maxResults and nextPageToken implement opaque-cursor pagination.

func (*InMemoryBackend) GetAnomalyMonitors

func (b *InMemoryBackend) GetAnomalyMonitors(
	monitorARNList []string, maxResults int, nextPageToken string,
) ([]*AnomalyMonitor, string, error)

GetAnomalyMonitors returns anomaly monitors, optionally filtered by ARNs, sorted by MonitorARN. maxResults and nextPageToken implement opaque-cursor pagination (real AWS behaviour). If monitorARNList references an ARN that doesn't exist, it returns ErrUnknownMonitor, matching real AWS.

func (*InMemoryBackend) GetAnomalySubscriptions

func (b *InMemoryBackend) GetAnomalySubscriptions(
	subscriptionARNList []string,
	monitorARN string,
	maxResults int,
	nextPageToken string,
) ([]*AnomalySubscription, string, error)

GetAnomalySubscriptions returns anomaly subscriptions, optionally filtered by ARNs or monitor ARN, sorted by SubscriptionARN. maxResults and nextPageToken implement opaque-cursor pagination. If subscriptionARNList references an ARN that doesn't exist, it returns ErrUnknownSubscription, matching real AWS. monitorARN is a simple filter (real AWS does not require it to reference an existing monitor).

func (*InMemoryBackend) GetApproximateUsageRecords added in v1.2.0

func (b *InMemoryBackend) GetApproximateUsageRecords(
	services []string,
) (string, string, map[string]int64, int64)

GetApproximateUsageRecords returns estimated per-service usage record counts derived from the cost ledger's UsageQuantity over the trailing daysPerMonth-day lookback window, optionally filtered to services. Matches real AWS's GetApproximateUsageRecords shape: LookbackPeriod + per-service counts + a grand total.

func (*InMemoryBackend) GetCommitmentAnalysis

func (b *InMemoryBackend) GetCommitmentAnalysis(analysisID string) (*CommitmentAnalysis, error)

GetCommitmentAnalysis retrieves a commitment analysis by ID.

func (*InMemoryBackend) GetCostAndUsage

func (b *InMemoryBackend) GetCostAndUsage(
	start, end, granularity string,
	metrics []string,
	groupBy []GroupBySpec,
	serviceFilter []string,
) []ResultByTime

GetCostAndUsage aggregates cost ledger entries by granularity, applying optional GroupBy. serviceFilter only narrows by the SERVICE dimension; callers that need the full Filter expression (Dimensions on any modeled dimension, Tags, And/Or/Not) must use GetCostAndUsageFiltered instead.

func (*InMemoryBackend) GetCostAndUsageFiltered

func (b *InMemoryBackend) GetCostAndUsageFiltered(
	start, end, granularity string,
	metrics []string,
	groupBy []GroupBySpec,
	filter *ceExpression,
) []ResultByTime

GetCostAndUsageFiltered is GetCostAndUsage with the full Filter expression (Dimensions on any modeled dimension, Tags, And/Or/Not) applied via matchesExpression, instead of GetCostAndUsage's SERVICE-only narrowing.

func (*InMemoryBackend) GetCostCategories

func (b *InMemoryBackend) GetCostCategories(costCategoryName string) []string

GetCostCategories returns the distinct cost category values stored in the backend, optionally filtered by cost category name. Values are sorted alphabetically.

func (*InMemoryBackend) GetCostCategoryNames added in v1.3.1

func (b *InMemoryBackend) GetCostCategoryNames() []string

GetCostCategoryNames returns the distinct cost category names stored in the backend, sorted alphabetically. Real GetCostCategories emits this list instead of CostCategoryValues when the request omits CostCategoryName (see api_op_GetCostCategories.go: "If the CostCategoryName key isn't specified in the request, the CostCategoryValues fields aren't returned").

func (*InMemoryBackend) GetDimensionValues

func (b *InMemoryBackend) GetDimensionValues(dimension string) []string

GetDimensionValues returns unique values for the given dimension from the cost ledger.

func (*InMemoryBackend) GetDimensionValuesFiltered added in v1.3.1

func (b *InMemoryBackend) GetDimensionValuesFiltered(
	dimension, constraintDimension string, constraintValues []string,
) []string

GetDimensionValuesFiltered returns unique values for `dimension`, restricted to ledger entries whose `constraintDimension` value is one of constraintValues (when constraintDimension is non-empty). This gives a real, non-fabricated effect to GetDimensionValuesInput.Filter when it carries a single (non-nested) Dimensions clause.

func (*InMemoryBackend) GetForecastByTime

func (b *InMemoryBackend) GetForecastByTime(
	start, end, granularity, metric string,
	predictionIntervalLevel int,
	serviceFilter []string,
) ([]ForecastResult, float64, float64, float64)

GetForecastByTime returns per-bucket cost/usage forecasts for a time range, computed from the requested metric (GetCostForecastInput/ GetUsageForecastInput.Metric) over ledger entries narrowed by serviceFilter (GetCostForecastInput/GetUsageForecastInput.Filter's SERVICE dimension), matching the same pattern used across this file. A prior revision always used BlendedCost and ignored Filter regardless of what was requested.

func (*InMemoryBackend) GetReservationCoverage

func (b *InMemoryBackend) GetReservationCoverage(
	start, end, granularity string,
) []ReservationCoverageByTime

GetReservationCoverage returns synthetic RI coverage by time.

func (*InMemoryBackend) GetReservationCoverageFiltered added in v1.3.1

func (b *InMemoryBackend) GetReservationCoverageFiltered(
	start, end, granularity string, serviceFilter []string,
) []ReservationCoverageByTime

GetReservationCoverageFiltered is GetReservationCoverage narrowed to ledger entries whose Service is in serviceFilter (when non-empty), giving GetReservationCoverageInput.Filter's SERVICE dimension a real, non-fabricated effect. Other documented Filter dimensions (AZ, PLATFORM, TENANCY, ...) have no per-entry breakdown in this emulator's ledger and are not applied.

func (*InMemoryBackend) GetReservationPurchaseRecommendations

func (b *InMemoryBackend) GetReservationPurchaseRecommendations(
	service, lookback, term, payment string,
) []ReservationRecommendation

GetReservationPurchaseRecommendations returns synthetic RI purchase recommendations.

func (*InMemoryBackend) GetReservationUtilization

func (b *InMemoryBackend) GetReservationUtilization(
	start, end, granularity string,
) []ReservationUtilizationByTime

GetReservationUtilization returns synthetic RI utilization by time.

func (*InMemoryBackend) GetReservationUtilizationFiltered added in v1.3.1

func (b *InMemoryBackend) GetReservationUtilizationFiltered(
	start, end, granularity string, serviceFilter []string,
) []ReservationUtilizationByTime

GetReservationUtilizationFiltered is GetReservationUtilization narrowed to ledger entries whose Service is in serviceFilter (when non-empty), giving GetReservationUtilizationInput.Filter's SERVICE dimension a real, non-fabricated effect. Other documented Filter dimensions (AZ, PLATFORM, TENANCY, ...) have no per-entry breakdown in this emulator's ledger and are not applied.

func (*InMemoryBackend) GetRightsizingRecommendations

func (b *InMemoryBackend) GetRightsizingRecommendations(
	_ string,
) []RightsizingRecommendation

GetRightsizingRecommendations returns synthetic rightsizing recommendations.

func (*InMemoryBackend) GetSavingsPlansUtilization

func (b *InMemoryBackend) GetSavingsPlansUtilization(
	start, end string,
) *SavingsPlansUtilizationResult

GetSavingsPlansUtilization returns a synthetic savings-plans utilization aggregate.

func (*InMemoryBackend) GetSavingsPlansUtilizationDetails

func (b *InMemoryBackend) GetSavingsPlansUtilizationDetails(
	start, end string,
) []SavingsPlansUtilizationDetail

GetSavingsPlansUtilizationDetails returns per-plan utilization details.

func (*InMemoryBackend) GetTagKeys

func (b *InMemoryBackend) GetTagKeys() []string

GetTagKeys returns all distinct tag keys used across the cost ledger.

func (*InMemoryBackend) GetTagKeysFiltered added in v1.3.1

func (b *InMemoryBackend) GetTagKeysFiltered(constraintKey string, constraintValues []string) []string

GetTagKeysFiltered returns distinct tag keys, restricted to ledger entries whose `constraintKey` tag value is one of constraintValues (when constraintKey is non-empty). Gives GetTagsInput.Filter's Tags clause a real, non-fabricated effect.

func (*InMemoryBackend) GetTagValues

func (b *InMemoryBackend) GetTagValues(tagKey string) []string

GetTagValues returns distinct values for a tag key.

func (*InMemoryBackend) GetTagValuesFiltered added in v1.3.1

func (b *InMemoryBackend) GetTagValuesFiltered(tagKey, constraintKey string, constraintValues []string) []string

GetTagValuesFiltered returns distinct values of tagKey, restricted to ledger entries whose `constraintKey` tag value is one of constraintValues (when constraintKey is non-empty).

func (*InMemoryBackend) ListBackfillHistory

func (b *InMemoryBackend) ListBackfillHistory() []*BackfillJob

ListBackfillHistory returns backfill jobs sorted by RequestedAt descending. b.backfillJobs is an append-only slice (not a Table.All() map walk), so its insertion order is already stable across calls; the BackfillID tiebreak below only matters for RequestedAt's second-precision ties, making the full order deterministic for pagination cursoring.

func (*InMemoryBackend) ListCommitmentAnalyses

func (b *InMemoryBackend) ListCommitmentAnalyses(statusFilter string) []*CommitmentAnalysis

ListCommitmentAnalyses returns commitment analyses sorted by AnalysisStartedTime descending, optionally filtered to statusFilter.

Table.All() walks the table's backing map in unspecified order, and AnalysisStartedTime has only second precision, so two analyses started in the same second tie under a plain sort.Slice: the tiebreak on AnalysisID below makes the order fully deterministic across repeated calls instead of depending on map iteration order, which matters once pagination cursors on this same order (see handleListCommitmentPurchaseAnalyses).

func (*InMemoryBackend) ListCostAllocationTags

func (b *InMemoryBackend) ListCostAllocationTags(
	status, tagType string,
	tagKeys []string,
) []*CostAllocationTag

ListCostAllocationTags returns cost allocation tags, optionally filtered.

func (*InMemoryBackend) ListCostCategoryDefinitions

func (b *InMemoryBackend) ListCostCategoryDefinitions(
	maxResults int, nextPageToken, effectiveOn string,
) ([]*CostCategory, string)

ListCostCategoryDefinitions returns cost categories sorted by name with opaque pagination, narrowed to categories whose EffectiveStart is on or before effectiveOn -- see DescribeCostCategoryDefinition's EffectiveOn handling for why this backend can only honor "existed by this date", not real AWS's full historical-version lookup. Per ListCostCategoryDefinitionsInput.EffectiveOn's doc comment, an empty effectiveOn defaults to the current date rather than disabling the filter.

func (*InMemoryBackend) ListSavingsPlansGenerations added in v1.2.0

func (b *InMemoryBackend) ListSavingsPlansGenerations(
	status string,
	recommendationIDs []string,
) []*SavingsPlansGeneration

ListSavingsPlansGenerations returns generation jobs, optionally filtered by GenerationStatus and/or recommendationIDs (RecommendationId allow-list), most recently started first.

Table.All() walks the table's backing map in unspecified order, and GenerationStartedTime has only second precision, so two jobs started in the same second tie under a plain sort.Slice: the tiebreak on RecommendationID below makes the order fully deterministic across repeated calls instead of depending on map iteration order, which matters once pagination cursors on this same order (see handleListSavingsPlansPurchaseRecommendationGeneration).

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)

ListTagsForResource returns the tags for a CE resource by ARN.

func (*InMemoryBackend) ProvideAnomalyFeedback

func (b *InMemoryBackend) ProvideAnomalyFeedback(anomalyID, feedback string) error

ProvideAnomalyFeedback persists feedback for an anomaly.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the region for this backend instance.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all in-memory state.

func (*InMemoryBackend) Restore

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

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) StartJanitor

func (b *InMemoryBackend) StartJanitor(ctx context.Context, interval time.Duration)

StartJanitor launches a background goroutine that evicts anomalies older than the backend's TTL. It stops when ctx is cancelled.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, resourceTags map[string]string) error

TagResource adds or updates tags on a CE resource.

func (*InMemoryBackend) TagValueCost added in v1.3.1

func (b *InMemoryBackend) TagValueCost(tagKey, value, metric string) float64

TagValueCost sums the requested cost metric across ledger entries whose tag `tagKey` equals value. Used to give GetTags' SortBy a real ordering.

func (*InMemoryBackend) TaggedResources added in v1.3.1

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every CE resource ARN (cost categories, anomaly monitors, anomaly subscriptions) that currently has at least one tag applied via TagResource.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error

UntagResource removes tags from a CE resource.

func (*InMemoryBackend) UpdateAnomalyMonitor

func (b *InMemoryBackend) UpdateAnomalyMonitor(
	monARN, monitorName string,
) (*AnomalyMonitor, error)

UpdateAnomalyMonitor updates the name of an anomaly monitor.

func (*InMemoryBackend) UpdateAnomalySubscription

func (b *InMemoryBackend) UpdateAnomalySubscription(
	subARN, frequency, subscriptionName string,
	monitorARNList []string,
	subscribers []Subscriber,
	threshold float64,
	thresholdExpression *ceExpression,
) (*AnomalySubscription, error)

UpdateAnomalySubscription updates a CE anomaly subscription.

func (*InMemoryBackend) UpdateCostAllocationTagsStatus

func (b *InMemoryBackend) UpdateCostAllocationTagsStatus(
	updates []CostAllocationTagStatusEntry,
) []CostAllocationTagError

UpdateCostAllocationTagsStatus updates the Active/Inactive status of cost allocation tags. Returns a list of errors for tags that could not be updated.

func (*InMemoryBackend) UpdateCostCategoryDefinition

func (b *InMemoryBackend) UpdateCostCategoryDefinition(
	catARN, ruleVersion, defaultValue string,
	rules []CostCategoryRule,
	splitChargeRules []SplitChargeRule,
	requestedEffectiveStart string,
) (*CostCategory, error)

UpdateCostCategoryDefinition updates an existing cost category. requestedEffectiveStart, when non-empty, overrides the default "first day of the current month" -- same optional-field default as CreateCostCategoryDefinition (api_op_UpdateCostCategoryDefinition.go's EffectiveStart doc is identical to Create's: "If the date isn't provided, it's the first day of the current month").

type MetricValue

type MetricValue struct {
	Amount string `json:"Amount"`
	Unit   string `json:"Unit"`
}

MetricValue holds Amount+Unit for a cost metric.

type Provider

type Provider struct{}

Provider implements service.Provider for the Cost Explorer (Ce) service.

func (*Provider) Init

Init initializes the Cost Explorer service.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the logical name of the provider.

type ReservationCoverageAgg

type ReservationCoverageAgg struct {
	CoverageHours           ReservationCoverageHours           `json:"CoverageHours"`
	CoverageNormalizedUnits ReservationCoverageNormalizedUnits `json:"CoverageNormalizedUnits"`
	CoverageCost            ReservationCoverageCost            `json:"CoverageCost"`
}

ReservationCoverageAgg holds RI coverage aggregates.

type ReservationCoverageByTime

type ReservationCoverageByTime struct {
	TimePeriod map[string]string      `json:"TimePeriod"`
	Total      ReservationCoverageAgg `json:"Total"`
	Groups     []any                  `json:"Groups"`
}

ReservationCoverageByTime holds RI coverage for a time period.

type ReservationCoverageCost

type ReservationCoverageCost struct {
	OnDemandCost string `json:"OnDemandCost"`
}

ReservationCoverageCost holds cost-based RI coverage.

type ReservationCoverageHours

type ReservationCoverageHours struct {
	OnDemandHours           string `json:"OnDemandHours"`
	ReservedHours           string `json:"ReservedHours"`
	TotalRunningHours       string `json:"TotalRunningHours"`
	CoverageHoursPercentage string `json:"CoverageHoursPercentage"`
}

ReservationCoverageHours holds hourly RI coverage data.

type ReservationCoverageNormalizedUnits

type ReservationCoverageNormalizedUnits struct {
	OnDemandNormalizedUnits           string `json:"OnDemandNormalizedUnits"`
	ReservedNormalizedUnits           string `json:"ReservedNormalizedUnits"`
	TotalRunningNormalizedUnits       string `json:"TotalRunningNormalizedUnits"`
	CoverageNormalizedUnitsPercentage string `json:"CoverageNormalizedUnitsPercentage"`
}

ReservationCoverageNormalizedUnits holds normalized unit coverage.

type ReservationRecommendation

type ReservationRecommendation struct {
	ServiceSpecification  map[string]any                    `json:"ServiceSpecification,omitempty"`
	RecommendationSummary map[string]string                 `json:"RecommendationSummary,omitempty"`
	AccountScope          string                            `json:"AccountScope,omitempty"`
	LookbackPeriodInDays  string                            `json:"LookbackPeriodInDays,omitempty"`
	TermInYears           string                            `json:"TermInYears,omitempty"`
	PaymentOption         string                            `json:"PaymentOption,omitempty"`
	RecommendationDetails []ReservationRecommendationDetail `json:"RecommendationDetails"`
}

ReservationRecommendation holds a single RI recommendation group.

type ReservationRecommendationDetail

type ReservationRecommendationDetail struct {
	AccountID                                 string         `json:"AccountId,omitempty"`
	InstanceDetails                           map[string]any `json:"InstanceDetails,omitempty"`
	RecommendedNumberOfInstancesToPurchase    string         `json:"RecommendedNumberOfInstancesToPurchase"`
	RecommendedNormalizedUnitsToPurchase      string         `json:"RecommendedNormalizedUnitsToPurchase"`
	MinimumNumberOfInstancesUsedPerHour       string         `json:"MinimumNumberOfInstancesUsedPerHour"`
	MinimumNormalizedUnitsUsedPerHour         string         `json:"MinimumNormalizedUnitsUsedPerHour"`
	MaximumNumberOfInstancesUsedPerHour       string         `json:"MaximumNumberOfInstancesUsedPerHour"`
	MaximumNormalizedUnitsUsedPerHour         string         `json:"MaximumNormalizedUnitsUsedPerHour"`
	AverageNumberOfInstancesUsedPerHour       string         `json:"AverageNumberOfInstancesUsedPerHour"`
	AverageNormalizedUnitsUsedPerHour         string         `json:"AverageNormalizedUnitsUsedPerHour"`
	AverageUtilization                        string         `json:"AverageUtilization"`
	EstimatedBreakEvenInMonths                string         `json:"EstimatedBreakEvenInMonths"`
	CurrencyCode                              string         `json:"CurrencyCode"`
	EstimatedMonthlySavingsAmount             string         `json:"EstimatedMonthlySavingsAmount"`
	EstimatedMonthlySavingsPercentage         string         `json:"EstimatedMonthlySavingsPercentage"`
	EstimatedMonthlyOnDemandCost              string         `json:"EstimatedMonthlyOnDemandCost"`
	EstimatedReservationCostForLookbackPeriod string         `json:"EstimatedReservationCostForLookbackPeriod"`
	UpfrontCost                               string         `json:"UpfrontCost"`
	RecurringStandardMonthlyCost              string         `json:"RecurringStandardMonthlyCost"`
}

ReservationRecommendationDetail is one RI recommendation.

type ReservationUtilizationAgg

type ReservationUtilizationAgg struct {
	UtilizationPercentage     string `json:"UtilizationPercentage"`
	PurchasedHours            string `json:"PurchasedHours"`
	TotalActualHours          string `json:"TotalActualHours"`
	UnusedHours               string `json:"UnusedHours"`
	OnDemandCostOfRIHoursUsed string `json:"OnDemandCostOfRIHoursUsed"`
	NetRISavings              string `json:"NetRISavings"`
	TotalPotentialRISavings   string `json:"TotalPotentialRISavings"`
	AmortizedUpfrontFee       string `json:"AmortizedUpfrontFee"`
	AmortizedRecurringFee     string `json:"AmortizedRecurringFee"`
	TotalAmortizedFee         string `json:"TotalAmortizedFee"`
	RICostForUnusedHours      string `json:"RICostForUnusedHours"`
	RealizedSavings           string `json:"RealizedSavings"`
	UnrealizedSavings         string `json:"UnrealizedSavings"`
}

ReservationUtilizationAgg holds RI utilization aggregates.

type ReservationUtilizationByTime

type ReservationUtilizationByTime struct {
	TimePeriod map[string]string         `json:"TimePeriod"`
	Total      ReservationUtilizationAgg `json:"Total"`
	Groups     []any                     `json:"Groups"`
}

ReservationUtilizationByTime holds RI utilization for a time period.

type ResultByTime

type ResultByTime struct {
	TimePeriod map[string]string      `json:"TimePeriod"`
	Total      map[string]MetricValue `json:"Total"`
	Groups     []CostGroup            `json:"Groups"`
	Estimated  bool                   `json:"Estimated"`
}

ResultByTime represents a single time period in GetCostAndUsage.

type RightsizingCurrentInstance

type RightsizingCurrentInstance struct {
	ResourceID   string `json:"ResourceId"`
	InstanceType string `json:"InstanceType,omitempty"`
	MonthlyCost  string `json:"MonthlyCost,omitempty"`
	CurrencyCode string `json:"CurrencyCode,omitempty"`
}

RightsizingCurrentInstance holds details about the current instance.

type RightsizingModifyDetail

type RightsizingModifyDetail struct {
	TargetInstances []RightsizingTargetInstance `json:"TargetInstances"`
}

RightsizingModifyDetail holds modification target options.

type RightsizingRecommendation

type RightsizingRecommendation struct {
	ModifyRecommendationDetail    *RightsizingModifyDetail    `json:"ModifyRecommendationDetail,omitempty"`
	TerminateRecommendationDetail *RightsizingTerminateDetail `json:"TerminateRecommendationDetail,omitempty"`
	CurrentInstance               RightsizingCurrentInstance  `json:"CurrentInstance"`
	AccountID                     string                      `json:"AccountId"`
	RightsizingType               string                      `json:"RightsizingType"`
}

RightsizingRecommendation is a single rightsizing recommendation.

type RightsizingTargetInstance

type RightsizingTargetInstance struct {
	ResourceDetails            map[string]any `json:"ResourceDetails,omitempty"`
	EstimatedMonthlyCost       string         `json:"EstimatedMonthlyCost"`
	EstimatedMonthlySavings    string         `json:"EstimatedMonthlySavings"`
	EstimatedSavingsPercentage string         `json:"EstimatedSavingsPercentage"`
	CurrencyCode               string         `json:"CurrencyCode"`
	DefaultTargetInstance      bool           `json:"DefaultTargetInstance"`
}

RightsizingTargetInstance is a recommended replacement instance.

type RightsizingTerminateDetail

type RightsizingTerminateDetail struct {
	EstimatedMonthlySavings string `json:"EstimatedMonthlySavings,omitempty"`
	CurrencyCode            string `json:"CurrencyCode,omitempty"`
}

RightsizingTerminateDetail holds termination savings estimate.

type SavingsPlansAmortized

type SavingsPlansAmortized struct {
	AmortizedRecurringCommitment string `json:"AmortizedRecurringCommitment"`
	AmortizedUpfrontCommitment   string `json:"AmortizedUpfrontCommitment"`
	TotalAmortizedCommitment     string `json:"TotalAmortizedCommitment"`
}

SavingsPlansAmortized holds amortized commitment.

type SavingsPlansGeneration added in v1.2.0

type SavingsPlansGeneration struct {
	RecommendationID         string `json:"recommendationId"`
	GenerationStatus         string `json:"generationStatus"` // PROCESSING|SUCCEEDED|FAILED
	GenerationStartedTime    string `json:"generationStartedTime"`
	GenerationCompletionTime string `json:"generationCompletionTime,omitempty"`
	EstimatedCompletionTime  string `json:"estimatedCompletionTime"`
}

SavingsPlansGeneration represents a Savings Plans purchase recommendation generation job, matching real AWS CE's GenerationSummary shape (RecommendationId, not GenerationId -- see api_op_StartSavingsPlansPurchaseRecommendationGeneration.go).

type SavingsPlansSavings

type SavingsPlansSavings struct {
	NetSavings             string `json:"NetSavings"`
	OnDemandCostEquivalent string `json:"OnDemandCostEquivalent"`
}

SavingsPlansSavings holds SP savings.

type SavingsPlansUtilizationAgg

type SavingsPlansUtilizationAgg struct {
	TotalCommitment       string `json:"TotalCommitment"`
	UsedCommitment        string `json:"UsedCommitment"`
	UnusedCommitment      string `json:"UnusedCommitment"`
	UtilizationPercentage string `json:"UtilizationPercentage"`
}

SavingsPlansUtilizationAgg holds SP utilization aggregates.

type SavingsPlansUtilizationDetail

type SavingsPlansUtilizationDetail struct {
	Attributes          map[string]string           `json:"Attributes,omitempty"`
	Utilization         *SavingsPlansUtilizationAgg `json:"Utilization,omitempty"`
	AmortizedCommitment *SavingsPlansAmortized      `json:"AmortizedCommitment,omitempty"`
	Savings             *SavingsPlansSavings        `json:"Savings,omitempty"`
	SavingsPlanARN      string                      `json:"SavingsPlanArn"`
}

SavingsPlansUtilizationDetail is a per-plan utilization entry. Utilization/AmortizedCommitment/Savings/Attributes are pointers so GetSavingsPlansUtilizationDetailsInput.DataType (real []types.SavingsPlansDataType -- ATTRIBUTES/UTILIZATION/ AMORTIZED_COMMITMENT/SAVINGS) can genuinely omit the sections a request didn't ask for, matching real AWS's per-item selective population instead of always emitting every section regardless of what was requested.

type SavingsPlansUtilizationResult

type SavingsPlansUtilizationResult struct {
	Utilization         SavingsPlansUtilizationAgg `json:"Utilization"`
	Savings             SavingsPlansSavings        `json:"Savings"`
	AmortizedCommitment SavingsPlansAmortized      `json:"AmortizedCommitment"`
}

SavingsPlansUtilizationResult is the total savings plans utilization.

type SplitChargeRule

type SplitChargeRule struct {
	Source  string   `json:"source"`
	Method  string   `json:"method"`
	Targets []string `json:"targets"`
}

SplitChargeRule represents a cost category split charge rule.

type Subscriber

type Subscriber struct {
	Address string `json:"address"`
	Type    string `json:"type"`
	Status  string `json:"status"`
}

Subscriber represents a CE anomaly subscription notification target.

type TaggedEntry added in v1.3.1

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a resource ARN with its tags.

type TotalImpactFilter

type TotalImpactFilter struct {
	NumericOperator string
	StartValue      float64
	EndValue        float64
}

TotalImpactFilter narrows GetAnomalies results by an anomaly's total dollar impact -- mirrors aws-sdk-go-v2/service/costexplorer/types.TotalImpactFilter.

Jump to

Keyboard shortcuts

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