-
Notifications
You must be signed in to change notification settings - Fork 9
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
Atlas plugin with DCO commit #41
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a last few things - also, your DCO failed 😢
requestErrors := validateRequest(req) | ||
if len(requestErrors) > 0 { | ||
//return empty response | ||
return results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
|
||
if err1 != nil || err2 != nil { | ||
// If parsing fails, skip this item | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log the errors here so we at least know something is up
// // Iterate over the UsageDetails in CostResponse | ||
// for _, lineItem := range pendingInvoicesResponse.LineItems { | ||
// Create a new pb.CustomCost for each LineItem | ||
//log.Debugf("Line item %v", item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm dead code
log.Debugf("Line Item %s %s", startDate.UTC(), endDate.UTC()) | ||
// Check if the item's StartDate >= win.start and EndDate <= win.end | ||
if (startDate.UTC().After(winStartUTC) || startDate.UTC().Equal(winStartUTC)) && | ||
(endDate.UTC().Before(winEndUTC) || endDate.UTC().Equal(winEndUTC)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup this is good!
|
||
func (a *AtlasCostSource) getAtlasCostsForWindow(win *opencost.Window, lineItems []atlasplugin.LineItem) (*pb.CustomCostResponse, error) { | ||
|
||
//filter responses between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfinished comment?
MagicCookieValue: "mongodb-atlas", | ||
} | ||
|
||
const costExplorerPendingInvoices = "https://cloud.mongodb.com/api/atlas/v2/orgs/%s/invoices/pending" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const costExplorerPendingInvoices = "https://cloud.mongodb.com/api/atlas/v2/orgs/%s/invoices/pending" | |
const costExplorerPendingInvoicesURL = "https://cloud.mongodb.com/api/atlas/v2/orgs/%s/invoices/pending" |
} | ||
|
||
func GetPendingInvoices(org string, client HTTPClient) ([]atlasplugin.LineItem, error) { | ||
request, _ := http.NewRequest("GET", fmt.Sprintf(costExplorerPendingInvoices, org), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request, _ := http.NewRequest("GET", fmt.Sprintf(costExplorerPendingInvoices, org), nil) | |
request, _ := http.NewRequest("GET", fmt.Sprintf(costExplorerPendingInvoicesURL, org), nil) |
StatusCode: http.StatusOK, | ||
Body: io.NopCloser(bytes.NewBuffer(mockResponseJson)), | ||
}, nil | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice mock!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving, we can patch later, none of my comments are blocking
…kal.com>
What does this PR change?
Does this PR relate to any other PRs?
How will this PR impact users?
Does this PR address any GitHub or Zendesk issues?
How was this PR tested?
Does this PR require changes to documentation?