Documentation
¶
Index ¶
- func Diagnostic(diag *diagnostic.Diagnostic)
- func Diagnostics(diags *diagnostic.Diagnostics)
- type CostComponentOutput
- type DiagnosticOutput
- type FailingTaggingResourceOutput
- type FinopsFailingResourceOutput
- type FinopsIssueOutput
- type FinopsOutput
- type InvalidTagOutput
- type Output
- type ProjectOutput
- type ProjectResult
- type ResourceMetadata
- type ResourceOutput
- type Result
- type TagPropagationProblemOutput
- type TaggingOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diagnostic ¶
func Diagnostic(diag *diagnostic.Diagnostic)
Diagnostic prints a diagnostic to stderr.
func Diagnostics ¶
func Diagnostics(diags *diagnostic.Diagnostics)
Diagnostics prints the diagnostics to stderr.
Types ¶
type CostComponentOutput ¶
type CostComponentOutput struct {
Name string `json:"name"`
Unit string `json:"unit"`
Price *rat.Rat `json:"price,omitempty"`
Quantity *rat.Rat `json:"quantity,omitempty"`
BaseMonthlyCost *rat.Rat `json:"base_monthly_cost,omitempty"`
UsageMonthlyCost *rat.Rat `json:"usage_monthly_cost,omitempty"`
TotalMonthlyCost *rat.Rat `json:"total_monthly_cost,omitempty"`
MonthlyCarbonSavingsGramsCo2E *rat.Rat `json:"monthly_carbon_savings_grams_co2e,omitempty"`
MonthlyWaterSavingsLiters *rat.Rat `json:"monthly_water_savings_liters,omitempty"`
}
type DiagnosticOutput ¶
type FailingTaggingResourceOutput ¶
type FailingTaggingResourceOutput struct {
Address string `json:"address"`
ResourceType string `json:"resource_type"`
InvalidTags []InvalidTagOutput `json:"invalid_tags"`
Path string `json:"path"`
Line int `json:"line"`
MissingMandatoryTags []string `json:"missing_mandatory_tags"`
PropagationProblems []TagPropagationProblemOutput `json:"propagation_problems"`
}
type FinopsFailingResourceOutput ¶
type FinopsFailingResourceOutput struct {
Name string `json:"name"`
Issues []FinopsIssueOutput `json:"issues"`
}
type FinopsIssueOutput ¶
type FinopsIssueOutput struct {
Description string `json:"description"`
MonthlySavings *rat.Rat `json:"monthly_savings,omitempty"`
MonthlyCarbonSavingsGramsCo2E *rat.Rat `json:"monthly_carbon_savings_grams_co2e,omitempty"`
MonthlyWaterSavingsLiters *rat.Rat `json:"monthly_water_savings_liters,omitempty"`
Address string `json:"address,omitempty"`
Attribute string `json:"attribute,omitempty"`
}
type FinopsOutput ¶
type FinopsOutput struct {
PolicyID string `json:"policy_id"`
PolicyName string `json:"policy_name"`
PolicySlug string `json:"policy_slug"`
PolicyMessage string `json:"policy_message"`
FailingResources []FinopsFailingResourceOutput `json:"failing_resources"`
}
type InvalidTagOutput ¶
type InvalidTagOutput struct {
Key string `json:"key"`
Value string `json:"value"`
ValidRegex string `json:"valid_regex"`
Suggestion string `json:"suggestion"`
Message string `json:"message"`
ValidValues []string `json:"valid_values"`
ValidValueCount int `json:"valid_value_count"`
ValidValuesTruncated bool `json:"valid_values_truncated"`
FromDefaultTags bool `json:"from_default_tags"`
MissingMandatory bool `json:"missing_mandatory"`
}
type Output ¶
type Output struct {
Currency string `json:"currency"`
Projects []ProjectOutput `json:"projects"`
// contains filtered or unexported fields
}
Output is the top-level JSON structure produced by the scan command.
func (*Output) TrackDiff ¶
TrackDiff compares this output against a previous output and fires a "cloud-issue-fixed" event for every policy violation that was present in other but is no longer present in this output. Projects are matched by name.
func (*Output) TrackRun ¶
func (o *Output) TrackRun(ctx context.Context, client *events.Client, runSeconds float64, outputFormat string)
TrackRun posts an "infracost-run" event with metadata derived from the scan output. The following v1 metadata fields are intentionally omitted:
Not yet implemented:
- isAWSChina: needs region info from resources.
- exampleProjectName: needs pattern matching on project names.
- resourceWarnings: needs pricing warnings from providers.
Not applicable to v2:
- absHclPercentChange, hclPercentChange, hclProjectRunTimeMs, hclRunTimeMs, tfProjectRunTimeMs, tfRunTimeMs, tfVarPresent: HCL/Terraform timing fields that don't apply to the plugin-based architecture.
- terraformBinary, terraformFullVersion, terraformInfracostProviderEnabled, terraformRemoteExecutionModeEnabled: Terraform-specific fields.
- ciPercentageThreshold, ciPostCondition, ciScript: CI integration config that isn't part of the v2 CLI.
- usageEstimateErrors, usageEstimates, usageSyncs: usage sync fields from the --sync-usage-file flow which doesn't exist in v2.
- remediationAttempts, remediationErrors, remediationOpportunities: not yet implemented.
type ProjectOutput ¶
type ProjectOutput struct {
ProjectName string `json:"project_name"`
Path string `json:"path"`
FinopsResults []FinopsOutput `json:"finops_results"`
TaggingResults []TaggingOutput `json:"tagging_results,omitempty"`
Resources []ResourceOutput `json:"resources"`
Diagnostics []DiagnosticOutput `json:"diagnostics,omitempty"`
}
type ProjectResult ¶
type ProjectResult struct {
Diagnostics []*diagnostic.Diagnostic
Config *config.Project
FinopsResults []*provider.FinopsPolicyResult
TagPolicyResults []event.TaggingPolicyResult
Resources []*provider.Resource
}
type ResourceMetadata ¶
type ResourceOutput ¶
type ResourceOutput struct {
Name string `json:"name"`
Type string `json:"type"`
IsSupported bool `json:"is_supported"`
IsFree bool `json:"is_free"`
CostComponents []CostComponentOutput `json:"cost_components,omitempty"`
Subresources []ResourceOutput `json:"subresources,omitempty"`
SupportsTags bool `json:"supports_tags,omitempty"`
SupportsDefaultTags bool `json:"supports_default_tags,omitempty"`
Metadata ResourceMetadata `json:"metadata"`
}
type Result ¶
type Result struct {
Config *config.Config
Projects []*ProjectResult
// EstimatedUsageCounts tracks usage parameters with non-zero values, keyed
// by "resourceType.attribute". A nil map means no usage file was loaded; a
// non-nil (possibly empty) map means a usage file was present.
EstimatedUsageCounts map[string]int
// UnestimatedUsageCounts tracks usage parameters with zero/empty values,
// keyed by "resourceType.attribute". Nil/non-nil semantics match
// EstimatedUsageCounts.
UnestimatedUsageCounts map[string]int
}
type TaggingOutput ¶
type TaggingOutput struct {
PolicyID string `json:"policy_id"`
PolicyName string `json:"policy_name"`
Message string `json:"message"`
FailingResources []FailingTaggingResourceOutput `json:"failing_resources"`
}
Click to show internal directories.
Click to hide internal directories.