Documentation ¶
Index ¶
- Variables
- func ReportCLIError(ctx *config.RunContext, cliErr error, replacePath bool) error
- type APIClient
- type APIError
- type APIErrorResponse
- type ActualCostComponent
- type ActualCostsQueryVariables
- type ActualCostsResult
- type AddRunResponse
- type AuthClient
- type CloudResourceIDVariables
- type CreateAPIKeyResponse
- type DashboardAPIClient
- type GraphQLQuery
- type Policy
- type PolicyClient
- type PolicyDecisionResponse
- type PriceQueryKey
- type PriceQueryResult
- type PricingAPIClient
- type QueryCLISettingsResponse
- type ResourceIDAddress
- type UsageAPIClient
- func (c *UsageAPIClient) ListActualCosts(vars ActualCostsQueryVariables) ([]ActualCostsResult, error)
- func (c *UsageAPIClient) ListUsageQuantities(vars UsageQuantitiesQueryVariables) (map[string]gjson.Result, error)
- func (c *UsageAPIClient) UploadCloudResourceIDs(vars CloudResourceIDVariables) error
- type UsageQuantitiesQueryVariables
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAPIKey = errors.New("Invalid API key")
Functions ¶
func ReportCLIError ¶
func ReportCLIError(ctx *config.RunContext, cliErr error, replacePath bool) error
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
func (*APIClient) AddAuthHeaders ¶
func (*APIClient) AddDefaultHeaders ¶
type APIErrorResponse ¶
type APIErrorResponse struct {
Error string `json:"error"`
}
type ActualCostComponent ¶ added in v0.10.12
type ActualCostComponent struct { UsageType string Description string MonthlyCost string MonthlyQuantity string Price string Unit string Currency string }
ActualCostComponent represents an individual line item of actual costs for a resource
type ActualCostsQueryVariables ¶ added in v0.10.12
type ActualCostsResult ¶ added in v0.10.12
type ActualCostsResult struct { Address string ResourceID string StartTimestamp time.Time EndTimestamp time.Time CostComponents []ActualCostComponent }
ActualCostsResult contains the cost information of actual costs retrieved from the Infracost Cloud Usage API
type AddRunResponse ¶ added in v0.9.16
type AddRunResponse struct { RunID string `json:"id"` GuardrailCheck output.GuardrailCheck }
type AuthClient ¶ added in v0.10.3
type AuthClient struct {
Host string
}
AuthClient represents a client for Infracost's authentication process.
type CloudResourceIDVariables ¶ added in v0.10.13
type CloudResourceIDVariables struct { RepoURL string `json:"repoUrl"` ProjectWithWorkspace string `json:"project"` ResourceIDAddresses []ResourceIDAddress `json:"addressResourceIds"` }
type CreateAPIKeyResponse ¶
type DashboardAPIClient ¶
type DashboardAPIClient struct {
APIClient
}
func NewDashboardAPIClient ¶
func NewDashboardAPIClient(ctx *config.RunContext) *DashboardAPIClient
func (*DashboardAPIClient) AddRun ¶
func (c *DashboardAPIClient) AddRun(ctx *config.RunContext, out output.Root) (AddRunResponse, error)
func (*DashboardAPIClient) QueryCLISettings ¶ added in v0.10.7
func (c *DashboardAPIClient) QueryCLISettings() (QueryCLISettingsResponse, error)
type GraphQLQuery ¶
type Policy ¶ added in v0.10.14
type Policy struct { ID string `json:"id"` Title string `json:"title"` Description string `json:"description"` ResourceType string `json:"resource_type"` ResourceAttributes json.RawMessage `json:"resource_attributes"` Address string `json:"address"` Suggested string `json:"suggested"` NoCost bool `json:"no_cost"` }
type PolicyClient ¶ added in v0.10.14
type PolicyClient struct {
// contains filtered or unexported fields
}
PolicyClient wraps the base http.Client with common handling patterns for the Infracost Cloud policy API.
func NewPolicyClient ¶ added in v0.10.14
func NewPolicyClient(config *config.Config, logger *logrus.Entry) PolicyClient
NewPolicyClient returns safely initialised PolicyClient.
func (PolicyClient) GetPolicies ¶ added in v0.10.14
func (r PolicyClient) GetPolicies(plan []byte) ([]Policy, error)
GetPolicies fetches cost optimization policy from Infracost Cloud.
type PolicyDecisionResponse ¶ added in v0.10.14
type PolicyDecisionResponse struct {
Result []Policy `json:"result"`
}
type PriceQueryKey ¶
type PriceQueryKey struct { Resource *schema.Resource CostComponent *schema.CostComponent }
type PriceQueryResult ¶
type PriceQueryResult struct { PriceQueryKey Result gjson.Result }
type PricingAPIClient ¶
func NewPricingAPIClient ¶
func NewPricingAPIClient(ctx *config.RunContext) *PricingAPIClient
func (*PricingAPIClient) AddEvent ¶ added in v0.9.5
func (c *PricingAPIClient) AddEvent(name string, env map[string]interface{}) error
func (*PricingAPIClient) RunQueries ¶
func (c *PricingAPIClient) RunQueries(r *schema.Resource) ([]PriceQueryResult, error)
type QueryCLISettingsResponse ¶ added in v0.10.7
type ResourceIDAddress ¶ added in v0.10.13
type UsageAPIClient ¶ added in v0.10.12
func NewUsageAPIClient ¶ added in v0.10.12
func NewUsageAPIClient(ctx *config.RunContext) *UsageAPIClient
NewUsageAPIClient returns a new Infracost Cloud Usage API Client configured from the RunContext
func (*UsageAPIClient) ListActualCosts ¶ added in v0.10.12
func (c *UsageAPIClient) ListActualCosts(vars ActualCostsQueryVariables) ([]ActualCostsResult, error)
ListActualCosts queries the Infracost Cloud Usage API to retrieve any cloud provider reported costs associated with the resource.
func (*UsageAPIClient) ListUsageQuantities ¶ added in v0.10.12
func (c *UsageAPIClient) ListUsageQuantities(vars UsageQuantitiesQueryVariables) (map[string]gjson.Result, error)
ListUsageQuantities queries the Infracost Cloud Usage API to retrieve usage estimates derived from cloud provider reported usage and costs.
func (*UsageAPIClient) UploadCloudResourceIDs ¶ added in v0.10.13
func (c *UsageAPIClient) UploadCloudResourceIDs(vars CloudResourceIDVariables) error
UploadCloudResourceIDs uploads cloud resource IDs to the Infracost Cloud Usage API, so they may be used to calculate usage estimates.