Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add support for monthly billing details in excel format #139

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

chbmuc
Copy link

@chbmuc chbmuc commented Jan 28, 2022

This PR adds a generator for monthly billing details in excel format

@@ -37,6 +44,21 @@ func newBillingCmd(c *config) *cobra.Command {
Short: "manage bills",
Long: "TODO",
}
excelBillingCmd := &cobra.Command{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a new output option, e.g. -o xlsx as for yaml and json.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, as it generates ALL available billing data in one excel file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But actually csv creation is done serverside (cloud-api)

@@ -322,6 +352,422 @@ func (c *config) clusterUsageCSV(cur *models.V1ClusterUsageRequest) error {
return nil
}

func (c *config) excel() error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a printer not a command

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could rename this to "all", but I'm not sure how to generate an output for everything in the other formats.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json and yaml output is simply a serialization, table output is obviously a bit harder, can then be return a error like table output for all entities is not supported

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe even better instead of all a slice of entities which should be returned, e.g. cloudctl billing cluster,volume -o xlsx

k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible // indirect
sigs.k8s.io/controller-runtime v0.8.3 // indirect
)

require (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use 2 require stanzas

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for simpler error checking there is a must func provided

@majst01
Copy link
Collaborator

majst01 commented Apr 27, 2022

This is currently done on server side and thoroughly tested, having the same logic on the client side without tests is not a good idea an will lead to differences in both results and issues raised by customers.

Closing.

@majst01 majst01 closed this Apr 27, 2022
@majst01 majst01 reopened this Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants