costs

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CostsService

type CostsService common.Service

CostsService is the client costs service

func New

func New(client common.Client) *CostsService

New creates a new CostsService, which can be used to retrieve cost informations for customer accounts and specific projects.

func (*CostsService) GetCustomerAccountCosts

func (svc *CostsService) GetCustomerAccountCosts(
	ctx context.Context,
	customerAccountID string,
	from, to time.Time,
	granularity, depth string,
) (*CustomerAccountResponse, error)

GetCustomerAccountCosts fetches cost data for a certain customer account in a specific time frame. The response is a list of project cost summaries. It provides a general cost overview for a certain customer account. See https://api.stackit.schwarz/costs-service/openapi.v1.html#operation/get-costs-reports-customer-account

func (*CostsService) GetProjectCosts

func (svc *CostsService) GetProjectCosts(
	ctx context.Context,
	customerAccountID,
	projectID string,
	from, to time.Time,
	granularity, depth string,
) (*ProjectDetailResponse, error)

GetProjectCosts fetches detailed cost data for a project in a specific time frame. The response contains all costs broken down into services used by the project. See https://api.stackit.schwarz/costs-service/openapi.v1.html#operation/get-costs-project

type CustomerAccountResponse

type CustomerAccountResponse []ProjectDetailResponse

CustomerAccountResponse is the response for customer account costs

type Date

type Date struct {
	From string `json:"start"`
	To   string `json:"end"`
}

Date represents a date range

type ProjectCostsResponse

type ProjectCostsResponse struct {
	ProjectID     string  `json:"projectId"`
	ProjectName   string  `json:"projectName"`
	TotalCharge   float64 `json:"totalCharge"`
	TotalDiscount float64 `json:"totalDiscount"`
}

ProjectCostsResponse is the response for project costs

type ProjectDetailResponse

type ProjectDetailResponse struct {
	ProjectCostsResponse
	Services []ServiceResponse `json:"services"`
}

ProjectDetailResponse is the costs for project and its services

type ReportDatapoint

type ReportDatapoint struct {
	Date     Date    `json:"timePeriod"`
	Charge   float64 `json:"charge"`
	Discount float64 `json:"discount"`
	Quantity int64   `json:"quantity"`
}

ReportDatapoint is a report data struct

type ServiceResponse

type ServiceResponse struct {
	TotalQuantity       int64             `json:"totalQuantity"`
	TotalCharge         float64           `json:"totalCharge"`
	TotalDiscount       float64           `json:"totalDiscount"`
	UnitLabel           string            `json:"unitLabel"`
	Sku                 string            `json:"sku"`
	ServiceName         string            `json:"serviceName"`
	ServiceCategoryName string            `json:"serviceCategoryName"`
	ReportData          []ReportDatapoint `json:"reportData"`
}

ServiceResponse is the costs for service

Jump to

Keyboard shortcuts

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