Documentation ¶
Index ¶
- Variables
- type BOM
- type BillOfMaterial
- func (billdata *BillOfMaterial) AddDependencyData(quantity int, title string, cost float64) BillOfMaterial
- func (billdata *BillOfMaterial) AddIncrementalCostData(resdata ResourceChanges, before, after float64) BillOfMaterial
- func (billdata *BillOfMaterial) AddLineItemData(resdata Resource, planID string, cost float64) BillOfMaterial
- type ClassicRateCard
- type Config
- type Container
- type CostV1Config
- type DependencyResource
- type GlobalCatalog
- type ISInstance
- type Metrics
- type Planstruct
- type RateCard
- type Request
- type Resource
- type ResourceChanges
- type ResourceConf
- type Respstruct
Constants ¶
This section is empty.
Variables ¶
View Source
var HostCount float64
View Source
var IncCostFuncMap = cf{
"ibm_is_volume": getVolumeCost2,
"ibm_is_vpn_gateway": getVpnCost2,
"ibm_is_image": getImageCost2,
"ibm_container_cluster": containerCost,
"ibm_container_worker_pool": workerPoolContainerCost,
"ibm_is_lb": getLoadBalancerCost,
"ibm_container_vpc_cluster": vpcContainerCost,
"ibm_container_vpc_worker_pool": vpcContainerCost,
"ibm_is_vpc": getVpcCost,
"ibm_is_instance": getInstanceCost,
"ibm_service_instance": serviceInstanceCost,
"ibm_resource_instance": serviceInstanceCost,
"ibm_is_subnet": getSubnetCost,
"ibm_is_floating_ip": getIPCost,
"ibm_satellite_cluster": getSatelliteCluster,
"ibm_satellite_cluster_worker_pool": getSatelliteCluster,
"ibm_database": getDatabaseCost,
"ibm_cloudant": getCloudantCost,
}
View Source
var ResourceFuncMap = pf{}
Functions ¶
This section is empty.
Types ¶
type BOM ¶
type BOM struct { Country string `json:"country"` Currency string `json:"currency"` TotalCost float64 `json:"totalcost"` Lineitem []BillOfMaterial }
func (*BOM) AddItem ¶
func (bom *BOM) AddItem(item BillOfMaterial) []BillOfMaterial
AddItem to the BOM
type BillOfMaterial ¶
type BillOfMaterial struct { Quantity int `json:"quantity" header:"quantity"` TerraformItemID string `json:"terraformItemId" header:"terraformItemId"` ID string `json:"id" header:"id"` RateCardCost bool `json:"rateCardCost" header:"rateCardCost"` Title string `json:"title" header:"title"` PlanID string `json:"planID" header:"planID"` ShortDescription string `json:"shortDescription" header:"shortDescription"` Features []string `json:"features" header:"features"` EstimateType string `json:"estimateType" header:"estimateType"` LineItemTotal float64 `json:"lineitemtotal" header:"lineitemtotal"` CurrLineItemTotal float64 `json:"currlineitemtotal" header:"currlineitemtotal"` PrevLineItemTotal float64 `json:"prevlineitemtotal" header:"prevlineitemtotal"` ChangeLineItemTotal float64 `json:"changelineitemtotal" header:"changelineitemtotal"` ResourceBreakdown []DependencyResource `json:"depends" header:"depends"` }
BillOfMaterial - output cost data for a resource
func (*BillOfMaterial) AddDependencyData ¶
func (billdata *BillOfMaterial) AddDependencyData(quantity int, title string, cost float64) BillOfMaterial
AddDependencyData to the BOM
func (*BillOfMaterial) AddIncrementalCostData ¶
func (billdata *BillOfMaterial) AddIncrementalCostData(resdata ResourceChanges, before, after float64) BillOfMaterial
AddLineItemData to the BOM
func (*BillOfMaterial) AddLineItemData ¶
func (billdata *BillOfMaterial) AddLineItemData(resdata Resource, planID string, cost float64) BillOfMaterial
AddLineItemData to the BOM
type ClassicRateCard ¶
type ClassicRateCard struct { BlockDevices interface{} `json:"blockDevices"` DataCenters interface{} `json:"datacenters"` Flavors []struct { Flavor struct { KeyName string `json:"keyName"` TotalMinimumRecurringFee string `json:"totalMinimumRecurringFee"` } `json:"flavor"` } Memory []struct { ItemPrice struct { RecurringFee string `json:"recurringFee"` } `json:"itemPrice"` Template struct { MaxMemory int `json:"maxMemory"` } `json:"template"` } NetworkComponents []struct { ItemPrice struct { RecurringFee string `json:"recurringFee"` DedicatedHostInstanceFlag bool `json:"dedicatedHostInstanceFlag"` } `json:"itemPrice"` Template struct { NetworkComponent []struct { MaxSpeed int `json:"maxSpeed"` } `json:"networkComponents"` PrivateNetworkOnly bool `json:"privateNetworkOnlyFlag"` } `json:"template"` } `json:"networkComponents"` OperatingSystems []struct { ItemPrice struct { RecurringFee string `json:"recurringFee"` } `json:"itemPrice"` Template struct { OperatingSystem string `json:"operatingSystemreferenceCode"` } `json:"template"` } `json:"operatingSystems"` Processors []struct { ItemPrice struct { RecurringFee string `json:"recurringFee"` } `json:"itemPrice"` Template struct { StartCpus int `json:"startCpus"` DedicatedHost bool `json:"dedicatedAccountHostOnlyFlag"` } `json:"template"` } }
type Container ¶
type Container struct { Datacenter string `json:"datacenter"` DefaultPoolSize int `json:"default_pool_size"` Hardware string `json:"hardware"` MachineType string `json:"machine_type"` Flavour string `json:"flavor"` Name string `json:"name"` UpdateAllWorkers bool `json:"update_all_workers"` WorkerNum int `json:"worker_num"` SizePerZone int `json:"size_per_zone"` WorkerCount int `json:"worker_count"` Zone []interface{} `json:"zones"` Plan string `json:"plan"` Service string `json:"service"` }
type CostV1Config ¶
type CostV1Config struct {
*Config
}
func NewTFCostClient ¶
func NewTFCostClient(config *Config) (*CostV1Config, error)
type DependencyResource ¶
type GlobalCatalog ¶
type GlobalCatalog struct { Origin string `json:"origin"` I18N struct { } `json:"i18n"` StartingPrice struct { } `json:"starting_price"` EffectiveFrom time.Time `json:"effective_from"` EffectiveUntil time.Time `json:"effective_until"` Metrics []struct { PartRef string `json:"part_ref"` MetricID string `json:"metric_id"` TierModel string `json:"tier_model"` ResourceDisplayName string `json:"resource_display_name"` ChargeUnitDisplayName string `json:"charge_unit_display_name"` ChargeUnitName string `json:"charge_unit_name"` ChargeUnit string `json:"charge_unit"` ChargeUnitQuantity int `json:"charge_unit_quantity"` Amounts []struct { Country string `json:"country"` Currency string `json:"currency"` Prices []struct { QuantityTier int `json:"quantity_tier"` Price float64 `json:"price"` } `json:"prices"` } `json:"amounts"` UsageCapQty int `json:"usage_cap_qty"` DisplayCap int `json:"display_cap"` EffectiveFrom string `json:"effective_from"` EffectiveUntil string `json:"effective_until"` } `json:"metrics"` }
type ISInstance ¶
type Planstruct ¶
type Planstruct struct { FormatVersion string `json:"format_version"` TerraformVersion string `json:"terraform_version"` PlannedValues struct { RootModule struct { Resources []Resource `json:"resources"` } `json:"root_module"` } `json:"planned_values"` ResourceChanges []ResourceChanges `json:"resource_changes"` Configuration struct { ProviderConfig struct { Ibm struct { Name string `json:"name"` Expressions struct { Generation struct { ConstantValue int `json:"constant_value"` } `json:"generation"` IbmcloudAPIKey struct { ConstantValue string `json:"constant_value"` } `json:"ibmcloud_api_key"` } `json:"expressions"` } `json:"ibm"` } `json:"provider_config"` RootModule struct { Resources []struct { Address string `json:"address"` Mode string `json:"mode"` Type string `json:"type"` Name string `json:"name"` ProviderConfigKey string `json:"provider_config_key"` Expressions struct { Name struct { ConstantValue string `json:"constant_value"` } `json:"name"` Subnets struct { ConstantValue []string `json:"constant_value"` } `json:"subnets"` } `json:"expressions"` SchemaVersion int `json:"schema_version"` } `json:"resources"` } `json:"root_module"` } `json:"configuration"` }
Planstruct consists of the entire json plandata
type Request ¶
type Request struct { ServiceID string `json:"service_id"` PlanID string `json:"plan_id"` Currency string `json:"currency"` Country string `json:"country"` Region string `json:"region"` Measures []Metrics `json:"measures"` }
Request payload struct
type Resource ¶
type Resource struct { Address string `json:"address"` Mode string `json:"mode"` Type string `json:"type"` Name string `json:"name"` ProviderName string `json:"provider_name"` SchemaVersion int `json:"schema_version"` Values struct { Container Generation int `json:"generation"` Name string `json:"name"` // Subnets []string `json:"subnets"` Timeouts interface{} `json:"timeouts"` Type string `json:"type"` Profile string `json:"profile"` Image string `json:"image"` Iops int `json:"iops"` Capacity int `json:"capacity"` BootVolume []interface{} `json:"boot_volume"` } `json:"values"` }
type ResourceChanges ¶
type ResourceChanges struct { Address string `json:"address"` Mode string `json:"mode"` Type string `json:"type"` Name string `json:"name"` ProviderName string `json:"provider_name"` Change struct { Actions []string `json:"actions"` Before ResourceConf `json:"before"` After ResourceConf `json:"after"` AfterUnknown struct { Hostname bool `json:"hostname"` ID bool `json:"id"` OperatingStatus bool `json:"operating_status"` PrivateIps bool `json:"private_ips"` PublicIps bool `json:"public_ips"` ResourceControllerURL bool `json:"resource_controller_url"` ResourceGroup bool `json:"resource_group"` ResourceGroupName bool `json:"resource_group_name"` ResourceName bool `json:"resource_name"` Status bool `json:"status"` } `json:"after_unknown"` } `json:"change"` }
type ResourceConf ¶
type ResourceConf struct { Container ISInstance Type string `json:"type"` Capacity int `json:"capacity"` Iops int `json:"iops"` FlavorKeyName string `json:"flavor_key_name"` Memory int `json:"memory"` Cores int `json:"cores"` OperatingSystemReferenceCode string `json:"os_reference_code"` DedicatedHostFlag bool `json:"dedicated_acct_host_only"` NetworkSpeed int `json:"network_speed"` PrivateNetworkOnly bool `json:"private_network_only"` MembersMemoryAllocationMB int `json:"members_memory_allocation_mb"` MembersDiskAllocationMB int `json:"members_disk_allocation_mb"` MembersCPUAllocationCount int `json:"members_cpu_allocation_count"` NodeCount int `json:"node_count"` NodeMemoryAllocationMB int `json:"node_memory_allocation_mb"` NodeDiskAllocationMB int `json:"node_disk_allocation_mb"` NodeCPUAllocationCount int `json:"node_cpu_allocation_count"` ImageID string `json:"image"` }
type Respstruct ¶
type Respstruct struct { Cost float64 `json:"cost"` Measures interface{} `json:"measures"` PlanID string `json:"plan_id"` }
Respstruct contains restapi response
Source Files ¶
- cost.go
- cost_resource_ibm_cloudant.go
- cost_resource_ibm_conatiner_vpc.go
- cost_resource_ibm_container.go
- cost_resource_ibm_container_worker_pool.go
- cost_resource_ibm_database.go
- cost_resource_ibm_is_floating_ip.go
- cost_resource_ibm_is_image.go
- cost_resource_ibm_is_instance.go
- cost_resource_ibm_is_lb.go
- cost_resource_ibm_is_volume.go
- cost_resource_ibm_is_vpc.go
- cost_resource_ibm_is_vpn_gateway.go
- cost_resource_ibm_others.go
- cost_resource_ibm_satellite_cluster.go
- cost_resource_ibm_service_instance.go
- model.go
- ratecardimplementation.go
Click to show internal directories.
Click to hide internal directories.