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

feat: Add Cost Calculation for DigitalOcean Volumes #1190

Merged

Conversation

bishal7679
Copy link
Contributor

Problem #1048

Currently, cost calculation for DigitalOcean volumes is not implemented!

Solution

This PR is fixing tiny issue by adding cost calculation support for volumes of digitalocean

Changes Made

  • Fetching the sizein GB of volume and then calculating the cost based on the fixed price from digitalocean volume pricing
  • fixed the hourly cost as static since its same for all volumes

Checklist

  • Code follows the contributing guidelines
  • Changes have been thoroughly tested
  • Documentation has been updated, if necessary
  • Any dependencies have been added to the project, if necessary

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@@ -13,6 +13,9 @@ import (
"github.com/tailwarden/komiser/providers"
)

var hourlyPrice float64
const createdLayout = "2006-01-02T15:04:05Z" // 2020-07-21T18:37:44Z
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the comment

@@ -13,6 +13,9 @@ import (
"github.com/tailwarden/komiser/providers"
)

var hourlyPrice float64
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please shift this var definition inside func

providers/digitalocean/storage/volumes.go Outdated Show resolved Hide resolved
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@bishal7679 bishal7679 force-pushed the feature/add-cost-digitalocean-volume branch from 62ddcb4 to 1714ad4 Compare November 13, 2023 13:50
func Volumes(ctx context.Context, client providers.ProviderClient) ([]models.Resource, error) {
var hourlyPrice float64
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I meant a little closer to it's usage 😆

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@bishal7679 bishal7679 force-pushed the feature/add-cost-digitalocean-volume branch from edd7a8a to 674789e Compare November 13, 2023 14:00
Co-authored-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
@mlabouardy mlabouardy merged commit 614e710 into tailwarden:develop Nov 13, 2023
3 checks passed
@bishal7679 bishal7679 deleted the feature/add-cost-digitalocean-volume branch January 4, 2024 03:28
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.

3 participants