CCI-MOC / openstack-billing-from-db

Simple billing from the database
Apache License 2.0
1 stars 3 forks source link

Upload CSV to S3 on completion #33

Closed knikolla closed 5 months ago

knikolla commented 5 months ago

Adds the option to upload the generated invoice to Backblaze S3 compatible storage. We're collecting our invoices in the Bucket nerc-invoicing under the account msd. (Backblaze doesn’t allow the concept of a shared bucket, but admins of the organization can log in under any user and access their buckets.)

Provide --upload-to-s3 True (defaults to false). It will upload two copies of the invoice using the below format (one for archiving and timestamped and one as a working copy)

/Invoices/<INVOICE_MONTH>/Service Invoices/<SERVICE> <INVOICE_MONTH>.csv
/Invoices/<INVOICE_MONTH>/Archive/<SERVICE> <INVOICE_MONTH> <TIMESTAMP>.csv

Where Timestamp is the time at generation using the ISO8601 format and without any special characters. See example below.

For example, for November 2023.

/Invoices/2023-11/Service Invoices/NERC OpenStack 2023-11.csv
/Invoices/2023-11/Service Invoices/NERC OpenShift 2023-11.csv
/Invoices/2023-11/Service Invoices/NERC Storage 2023-11.csv
/Invoices/2023-11/Archive/NERC OpenStack 2023-11 20231218T201706Z.csv
/Invoices/2023-11/Archive/NERC OpenShift 2023-11 20231218T201706Z.csv
/Invoices/2023-11/Archive/NERC Storage 2023-11 20231218T201706Z.csv

Tooling for OpenShift invoicing is already able to upload files using the above described conventions.